#ifndef __CLOTHING_BLOCK_H__
#define __CLOTHING_BLOCK_H__

#include "Block.hpp"
#include "Game/ClothingData.h"

namespace PocketSurvival
{
    // 衣服
    class ClothingBlock : public Block
    {
	public:
		std::vector<ClothingData> clothingDataVec;
        std::vector<ClothingData> dispalyVec;
		
    public:
        static constexpr int32_t Index()
        {
            return 203;
        }
        virtual int32_t getIndex() override; 
        virtual const std::string &getBlockName() override;

    	virtual const ClothingData &getClothingData(int32_t value) const;

		virtual void initialize() override;
        virtual void getCreativeValues(std::vector<int32_t> &blockVec) override;
        virtual int32_t getDamage(int32_t value) override;
        virtual int32_t setDamage(int32_t value, int32_t damage) override;

        static constexpr inline int32_t GetClothingIndex(int32_t data);
        static constexpr inline int32_t SetClothingIndex(int32_t data, int32_t clothingIndex);
        static constexpr inline int32_t GetClothingColor(int32_t data);
        static constexpr inline int32_t SetClothingColor(int32_t data, int32_t color);
    };

    constexpr inline int32_t ClothingBlock::GetClothingIndex(int32_t data)
    {
        return data & 0xFF;
    }

    constexpr inline int32_t ClothingBlock::SetClothingIndex(int32_t data, int32_t clothingIndex)
    {
        return (data & -256) | (clothingIndex & 0xFF);
    }

    constexpr inline int32_t ClothingBlock::GetClothingColor(int32_t data)
    {
        return (data >> 12) & 0xF;
    }

    constexpr inline int32_t ClothingBlock::SetClothingColor(int32_t data, int32_t color)
    {
        return (data & -61441) | ((color & 0xF) << 12);
    }

} // namespace PocketSurvival


#endif
